﻿// -------------------------------------------------------------------------
//    @FileName         :    NFLevelBlessPart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFLevelBlessPart
//
// -------------------------------------------------------------------------

#include "NFLevelBlessPart.h"

#include "proto_cs_login.pb.h"
#include "proto_db.pb.h"

NFLevelBlessPart::NFLevelBlessPart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFLevelBlessPart::~NFLevelBlessPart()
{
}

int NFLevelBlessPart::CreateInit()
{
    return 0;
}
    
int NFLevelBlessPart::ResumeInit()
{
    return 0;
}

int NFLevelBlessPart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_play_data().level_bless_data());
    return 0;
}

int NFLevelBlessPart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    CHECK_NULL(0, pDbData);
    auto pData = pDbData->mutable_role_play_data()->mutable_level_bless_data();
    CHECK_NULL(0, pData);

    for(int i = proto_ff::enLevelBlessType_MIN + 1; i <= proto_ff::enLevelBlessType_MAX; ++i)
    {
        proto_ff::SelectLevelBlessData* pDataOne = pData->add_bless();

        pDataOne->set_type((proto_ff::enLevelBlessType)i);
    }

    return 0;
}

int NFLevelBlessPart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_play_data()->mutable_level_bless_data());
    return 0;
}

int NFLevelBlessPart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    m_stData.ToPb(pCSGetRoleRsp->mutable_level_bless_data());
    return 0;
}

int NFLevelBlessPart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}
